<!DOCTYPE html>

<html>
<head>
    <title>Patterns with mummy</title>
    <script type="text/javascript" src="js/mummy.js" charset="utf-8"></script>
</head>

<body>
<script type="text/javascript" charset="utf-8">

Interface(
        function ICanard(){
                this.coinCoin = function(){};
        }
);

Class({
    $implements:[ICanard],
    $define:function Colvert(){
        this.coinCoin = function(){
            console.log('Je suis un colvert');
        };
        this.Colvert=function(){}
    }
});

Class({
    $implements:[ICanard],
    $define:function Mandarin(){
        this.coinCoin = function(){
            console.log('Je suis un mandarin');
        };
        this.Mandarin=function(){}
    }
});

Class({
    $implements:[ICanard],
    $define:function CanardJaune(){
        
        this.coinCoin = function(){
            console.log('Je suis un canard en plastique jaune');
        };
        
        this.CanardJaune=function(){}
    }
});

//Canards Factory
Class({
    $define:function MareAuxCanards(){},
    $static:{
        donneMoiUnCanard:function(choix){
            switch(choix){
                case "colvert":
                    return $(Colvert).getNew();
                break;
                case "mandarin":
                    return $(Mandarin).getNew();
                break;
                default:
                    return $(CanardJaune).getNew();
                break;
            }
        }
    }
});

var Daffy = MareAuxCanards.donneMoiUnCanard("colvert");
var Donald = MareAuxCanards.donneMoiUnCanard("mandarin");
var Fifi = MareAuxCanards.donneMoiUnCanard();

Daffy.coinCoin();
Donald.coinCoin();
Fifi.coinCoin();


</script>



</body>
</html>
